package net.cyan.activex;

import com.jacob.activeX.ActiveXComponent;

/**
 * <p>Title: activex对象</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author ccs
 * @version 1.0
 */
abstract public class ActiveX implements ActiveXObject
{
   static public ActiveX create(String activeXName,Class c) throws
       ActiveXException
   {
      try
      {
         ActiveXComponent component = new ActiveXComponent(activeXName);
         return(ActiveX)ActiveXProxy.createObject(c,component);
      }
      catch(ActiveXException ex)
      {
         throw ex;
      }
      catch(Throwable ex)
      {
         throw new ActiveXException("创建ActiveX对象" + activeXName + "失败:",
                                    ex);
      }
   }

   public void release()
   {
      getDispatch().release();
   }
}
